import {colorUISdk} from "../../config/mp-sdk";
import {updateCurrentPageShare} from "../../mp-sdk/lib/share";

Page({
    data: {
        reward: {},
    },
    onLoad() {
        this.statistics()
    },

    //下拉刷新
    onPullDownRefresh() {
        this.statistics()
    },
    statistics() {
        colorUISdk.request({
            url: 'api/user/statistics',
            method: 'GET',
            data: {
                'type':'account', // 账户
            }
        }).then(res => {
            if (res.code === 1) {
                this.setData({reward: res.data});
                // 登录成功后立即更新分享配置
                updateCurrentPageShare();
            } else {
                wx.showToast({title: res.msg, icon: 'none'});
            }
        });

    },
    goToWithdrawList() {
        wx.navigateTo({
            url: '/pages/yd_order/home?status=2'  // 可提现
        });
    },
    goToPendingList() {
        wx.navigateTo({
            url: '/pages/yd_order/home?status=0'  // 全部
        });
    },
    goToDoneList() {
        wx.navigateTo({
            url: '/pages/yd_order/home?status=1'  // 待提现
        });
    },
    goToRefund() {
        wx.navigateTo({
            url: '/pages/yd_order/home?status=5'  // 已退款
        });
    }
});
